#include "stream/impl/rocksdb/Meta.h"

#include "stream/impl/rocksdb/meta/Size.h"
#include "stream/impl/rocksdb/Rocksdb.h"

namespace stream {
namespace impl {
namespace rocksdb {

Meta::Meta(const std::string & dbname)
: ::stream::Meta(nullptr)
, _dbname(dbname)
{
	_db.reset(new Rocksdb(dbname));
	auto * sz = new meta::Size(_db, 0);
	this->size(sz);
}
Meta::~Meta(){
}

bool Meta::_open(){
	_db->createIfMissing();
	return true;
}
void Meta::_close() {
	_db->close();
}

::stream::impl::rocksdb::Meta * makeMeta(const std::string & path){
	return new ::stream::impl::rocksdb::Meta(path);
}


}//end namespace rocksdb
}//end namespace impl
}//end namespace stream

